/* $RCSFile: ADNDynDiscountType.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/CRMWrapper3/DynEntities/ADNDynDiscountType.cs $
 * $log$
 * Revision 19 2010/10/02 14:01:49  christian.surieux
 *   Corrected a bug in allmost everyADNDyn file for PrimaryFieldVualue
 * Revision 6 2010/08/06 19:56:32  christian.surieux
 *   Added Log to All cs files
 */

using System;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using CrmSdk;

namespace AddonNice.CRMWrapper
{
	public class ADNDynDiscountType : DynEntity
	{
        protected class Ftor: DFactor
        {
            public Ftor() : base(CrmStr.discounttype)
            {}

            public override Type DynType
            { get { return typeof(ADNDynDiscountType); } }

            public override string DynTypename
            {   get{ return CrmStr.discounttype;}}

            public override DynEntity Build()
            {   return new ADNDynDiscountType();}

            public override DynEntity Build(CRMWrapperBase w, InternalDynamicEntity dEntity, PropertyDescriptorCollection wproperties)
            {   return new ADNDynDiscountType(w, dEntity, wproperties, null);}

            public override DynEntity Build(CRMWrapperBase w, string PrimaryFieldValue)
            {   return new ADNDynDiscountType(w,PrimaryFieldValue);}

            public override DynEntity Build(CRMWrapperBase w,Guid PrimaryKeyValue)
            {   return new ADNDynDiscountType(w,PrimaryKeyValue);}
        }

        static ADNDynDiscountType(){new Ftor();} 

        public override bool HasOwnerProperty
        {
            get{   return false;}
        }

        public override bool HasOwninguser
        {
            get{   return false;}
        }

        public override bool HasBusinessUnitProperty
        {
            get{   return false;}
        }

        public override bool OwningbusinessunitAsUniqueIdentifier
        {
            get{   return false;}
        }

        /// <summary>
		/// Reserved for template methods: do not use directly
		/// </summary>
        public ADNDynDiscountType(): base()
		{}

        public ADNDynDiscountType(CRMWrapperBase w,string discountName)
			: base(w,CrmStr.discounttype)
		{
            if ( discountName != string.Empty )
                name    =   discountName;
		}

		public ADNDynDiscountType(CRMWrapperBase w, Guid CrmId)
			: base(w,CrmStr.discounttype, CrmId)
		{}

		public ADNDynDiscountType(ResetWrapperHandler fn,Guid CrmId)
			: base(fn,CrmStr.discounttype, CrmId)
		{}

        public ADNDynDiscountType(CRMWrapperBase w, InternalDynamicEntity e)
			: base(w,CrmStr.discounttype,e,null,null)
		{}
        public ADNDynDiscountType(ResetWrapperHandler fn,InternalDynamicEntity e)
			: base(fn,CrmStr.discounttype,e,null,null)
		{}

		public ADNDynDiscountType(CRMWrapperBase w, InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s)
			: base(w,CrmStr.discounttype,e,prop,s)
		{}
		
        public ADNDynDiscountType(ResetWrapperHandler fn,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s)
			: base(fn,CrmStr.discounttype,e,prop,s)
		{}

        [CrmDynAttribute(CrmStr.discounttype)]
		public Guid discounttypeid
		{
			get
			{
				return KeyPropertyValue(CrmStr.discounttypeid);
			}
			set
			{
				AddKeyProperty(CrmStr.discounttypeid, value);
			}
		}

        protected override void SetCrmIdProperty(Guid crmId)
        {
           if ( !dicProperty.ContainsKey(CrmStr.discounttypeid) || KeyPropertyValue(CrmStr.discounttypeid) != crmId )
                discounttypeid  =   crmId;
        }

        public override Guid PrimaryKeyGuidValue
        {
           get
           {
                return discounttypeid;
           }
           set
           {
               discounttypeid    =   value;
           }
        }

        public override string PrimaryFieldName
        {
            get
            {
               return CrmStr.name;
            }
           set
           {}
        }

        /// <summary>
        /// Value contained in the PrimaryField for the DynEntity or empty if no PrimaryField
        /// </summary>
        public override string PrimaryFieldStringValue
        {
            get
            {
                return name;
            }
            set
            {
                name =   value;
            }
        }

        [CrmDynAttribute(CrmStr.discounttype)]
        public bool isamounttype
        {
            get
            {
                return BooleanPropertyValue(CrmStr.isamounttype);
            }
            set
            {
                AddBooleanProperty(CrmStr.isamounttype,value);
            }
        }

        [CrmDynAttribute(CrmStr.discounttype)]
        public Guid transactioncurrencyid
        {
            get
            {
                return LookupPropertyValue(CrmStr.transactioncurrencyid);
            }
            set
            {
                AddLookupProperty(CrmStr.transactioncurrencyid,CrmStr.transactioncurrency,value);
            }
        }

        public string transactioncurrencyName
        {
            get
            {
                return LookupPropertyName(CrmStr.transactioncurrencyid);
            }
        }

        [CrmDynAttribute(CrmStr.discounttype)]
        public string description
        {
            get
            {
                return StringPropertyValue(CrmStr.description);
            }
            set
            {
                AddStringProperty(CrmStr.description,value);
            }
        }
    }
}
